<?php $id="form_".uniqid();?>
<table id="<?php echo $id;?>"></table>
<script>
    $("#<?php echo $id;?>").DataSource({url:'level/getlist',
        fields:[
            [
                {field:'name',title:'名称',rowspan:2,align:'center',width:100,sortable:true},
                {field:'desc',title:'描述',rowspan:2,align:'center',width:100,sortable:true},
                {title:'加入条件',colspan:3},
                {field:'member_count',title:'会员人数',  rowspan:2,align:'center', width:100,  sortable:true},
                {field:'rec_acc_count',title:'收款账户数',rowspan:2, align:'center',width:100,  sortable:true},
                {field:'pay_acc_count',title:'支付账户数', rowspan:2, align:'center', width:100,  sortable:true},
                {field:'remark',title:'备注', align:'center',  width:150, rowspan:2, sortable:true},
                {field:'op', title:'操作',align:'center', width:300,rowspan:2,sortable:false,formatter:function(v,r){
                    var str = '';
                    if (r.level != 0) {
                        str = '<a herf="#" class="btn btn-danger btn-xs" onclick=Core.confirm("<?php echo $id;?>",1,"asd","确定停用该会员使用?")>分层</a>&nbsp;'+
                            '<a herf="#" class="btn btn-danger btn-xs" onclick=Core.confirm("<?php echo $id;?>",1,"asd","确定停用该会员使用?")>回归</a>&nbsp;';
                    }

                    return str +
                    '<a herf="#" class="btn btn-danger btn-xs" onclick=Core.dialog(\'基本资料设定\',\'level/edituser\',function(){},true,true);>修改</a>&nbsp;&nbsp;'+
                    '<a herf="#" class="btn btn-danger btn-xs" onclick="edit_pay_type()">支付设定</a>&nbsp;&nbsp;'
                }}
            ],[
                {field:'join_time',title:'会员加入时间',width:200,align:'center',sortable:true},
                {field:'income_count',title:'存款次数',width:150,align:'center',sortable:true},
                {field:'income',title:'存款总额',width:150,align:'center'}
            ]

       ], tools:[
            {instant:false},
            <?php if(in_array('ADD',$auth)){?>
            {text:"新增层级",iconCls:"icon-add",handler:function(){
                $('#<?php echo $id?>').DataSource('add',{title:'新增层级',get:'level/edituser?>',full:true});
            }},
            <?php }?>
        ],
        checkbox:false,
        edit:true,
        footer:true,
        success:function(){

        }
    });

    function edit_pay_type()
    {
        Core.dialog('支付设定','level/pay_set',function(){},true,false);
    }
</script>